using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Kryptonalysis.Statistics;

namespace Kryptecizer
{
    public partial class StatisticsForm : DevExpress.XtraEditors.XtraForm
    {
        public StatisticsForm()
        {
            InitializeComponent();
        }

        public void Show(AnalysisStatistic stats)
        {
            if (stats != null)
            {
                chartControl1.Series.Clear();

                if (stats.Dividors != null)
                {

                    DevExpress.XtraCharts.Series s = new DevExpress.XtraCharts.Series("", DevExpress.XtraCharts.ViewType.Bar);
                    s.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Numerical;
                    s.SeriesPointsSorting = DevExpress.XtraCharts.SortingMode.Ascending;
                    s.ValueScaleType = DevExpress.XtraCharts.ScaleType.Numerical;

                    foreach (KeyValuePair<int, int> valItem in stats.Dividors)
                        if (valItem.Key < 50)
                            s.Points.Add(new DevExpress.XtraCharts.SeriesPoint(valItem.Key, valItem.Value));

                    s.Label.Visible = false;
                    chartControl1.Series.Add(s);
                }
            }
        }
    }
}